package com.gph.saviorframework.shiro.filter;

import org.apache.commons.lang.StringUtils;
import org.apache.shiro.web.filter.authc.LogoutFilter;

import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;

/**
 * Created by savior on 2016/3/8.
 */
public class CustomLogoutFilter extends LogoutFilter {

    @Override
    protected boolean preHandle(ServletRequest request, ServletResponse response) throws Exception {
        String logoutType = request.getParameter("logoutType");
        if(StringUtils.isEmpty(logoutType)){
            setRedirectUrl("/login");
        }
        else{
            if(logoutType.equals("bu")){
                setRedirectUrl("/login");
            }
        }
        return super.preHandle(request, response);
    }
}
